package com.xhwl.logistics.open;

import com.xhwl.common.enums.CodeEnum;
import com.xhwl.common.pojo.ResultJson;
import com.xhwl.common.vo.cent.vehicle.CarRecordVO;
import com.xhwl.common.vo.cent.vehicle.ParkingLotVO;
import com.xhwl.common.vo.cent.vehicle.PassageVO;
import com.xhwl.logistics.service.IPushDataService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * @description: 提供给厂商推送数据
 * @author: lu.Aaron
 * @create: 2021-03-05 11:15
 **/
//@RestController
@RequestMapping("/push-data")
@Api(tags = "厂商推送数据")
@Slf4j
//@ApiIgnore
public class PushDataController {
    @Autowired
    private IPushDataService pushDataService;



    @ApiOperation(value = "厂商推送进场车辆记录上报",notes = "输入框有required标识的字段为必填项", response = ResultJson.class, httpMethod = "POST")
    @ResponseBody
    @RequestMapping(value = "/car-in", method = RequestMethod.POST)
    public ResultJson pushCarInRecord(@RequestBody CarRecordVO carRecordVO)  {
        pushDataService.pushCarInRecord(carRecordVO);

        return  new ResultJson(true, CodeEnum.SUCCESS.getCode(),"推送成功");
    }
    @ApiOperation(value = "厂商推送出场车辆记录上报",notes = "输入框有required标识的字段为必填项", response = ResultJson.class, httpMethod = "POST")
    @ResponseBody
    @RequestMapping(value = "/car-out", method = RequestMethod.POST)
    public ResultJson pushCarOutRecord(@RequestBody @Validated CarRecordVO carRecordVO)  {
        pushDataService.pushCarOutRecord(carRecordVO);

        return  new ResultJson(true, CodeEnum.SUCCESS.getCode(),"推送成功");
    }


    @ApiOperation(value = "厂商新增车场推送",notes = "输入框有required标识的字段为必填项", response = ResultJson.class, httpMethod = "POST")
    @ResponseBody
    @RequestMapping(value = "/parkingLot", method = RequestMethod.POST)
    public ResultJson pushParkingLot(@RequestBody @Validated ParkingLotVO parkingLotVO) throws Exception {
        pushDataService.pushParkingLot(parkingLotVO);

        return  new ResultJson(true, CodeEnum.SUCCESS.getCode(),"推送成功");
    }
    @ApiOperation(value = "厂商新增通道推送",notes = "输入框有required标识的字段为必填项", response = ResultJson.class, httpMethod = "POST")
    @ResponseBody
    @RequestMapping(value = "/passage", method = RequestMethod.POST)
    public ResultJson pushPassage(@RequestBody PassageVO passageVO) throws Exception {
        pushDataService.pushPassage(passageVO);

        return  new ResultJson(true, CodeEnum.SUCCESS.getCode(),"推送成功");
    }
}

